fix(kafka): [Queue Instrumentation 36] Avoid dropping customer interceptor#5341
Open
adinauer wants to merge 5 commits intofeat/kafka-producer-wrapperfrom
Open
fix(kafka): [Queue Instrumentation 36] Avoid dropping customer interceptor#5341adinauer wants to merge 5 commits intofeat/kafka-producer-wrapperfrom
adinauer wants to merge 5 commits intofeat/kafka-producer-wrapperfrom
Conversation
If reading recordInterceptor via reflection fails, leave the container\nfactory untouched instead of installing Sentry's interceptor with a\nnull delegate. This avoids silently dropping customer-configured\ninterceptors for DLQ routing, auditing, or other message handling\nconcerns.\n\nAdd tests that preserve customer interceptors both when chaining\nsucceeds and when reflection cannot safely determine the existing\ninterceptor.\n\nCo-Authored-By: Claude <[email protected]>
This was referenced Apr 28, 2026
Merged
Open
Open
This was referenced Apr 28, 2026
📲 Install BuildsAndroid
|
lbloder
reviewed
Apr 28, 2026
This was referenced Apr 29, 2026
Open
…terceptor-reflection
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7f9aae6. Configure here.
…terceptor-reflection
Force the reflection-failure path in the consumer bean post processor test so it proves customer interceptors remain untouched when Sentry skips installation. Co-Authored-By: Claude <[email protected]>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Stack (Queue Instrumentation)
📜 Description
Avoid installing
SentryKafkaRecordInterceptorwhen the bean post-processor cannot safely read the existingrecordInterceptorfield fromAbstractKafkaListenerContainerFactory.Before this change, reflection failures fell back to
existing = null, and the post-processor still calledsetRecordInterceptor(sentryInterceptor). That could silently overwrite a customer-configured interceptor.After this change:
getExistingInterceptorthrows a dedicated exception when reflection failspostProcessAfterInitializationlogs an error and leaves the bean untouched💡 Motivation and Context
Addresses review finding R10-F003: reflection fallback silently drops the customer's existing
RecordInterceptor.Customers often use
RecordInterceptorfor DLQ routing, auditing, or other message handling behavior. If Sentry cannot safely discover the existing interceptor, it must disable consumer tracing for that factory instead of overwriting customer behavior.💚 How did you test it?
./gradlew spotlessApply apiDump./gradlew :sentry-spring-jakarta:test --tests "io.sentry.spring.jakarta.kafka.SentryKafkaConsumerBeanPostProcessorTest"📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Continue addressing the remaining Queue Instrumentation review findings.
#skip-changelog